﻿using MvvmFoundation.Wpf;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace ServiceOperater.ViewModels
{
    //  public sealed class FileTreeNodeViewModel : ObservableObject
    public sealed class ServiceTreeNodeViewModel : ObservableObject
    {

        public ServiceTreeNodeViewModel(string id)
        {
            this.Id = id;
            this.ActionChildren = new ObservableCollection<ActionTreeNodeViewModel>();
        }

        #region Props

        private string id = string.Empty;
        public string Id
        {
            get
            {
                return id;
            }
            set
            {
                if (id == value)
                {
                    return;
                }

                id = value;

                // TODO 保存起来！

                RaisePropertyChanged("Id");
            }
        }

        private bool isExpanded = true;
        public bool IsExpanded
        {
            get
            {
                return isExpanded;
            }
            set
            {
                if (isExpanded == value)
                {
                    return;
                }

                isExpanded = value;

                RaisePropertyChanged("IsExpanded");
            }
        }

        private bool isSelected = false;
        public bool IsSelected
        {
            get
            {
                return isSelected;
            }
            set
            {
                if (isSelected == value)
                {
                    return;
                }

                isSelected = value;

                RaisePropertyChanged("IsSelected");
            }
        }

        public ObservableCollection<ActionTreeNodeViewModel> ActionChildren { get; private set; }
        #endregion

        #region Commands

        public RelayCommand<Object> QueryCommand { get; private set; }

        #endregion

        #region 枚举数据源
        //public IEnumerable<ValueDescription> QXDMList
        //{ get { return EnumHelper.GetAllValuesAndDescriptions<QXDM>(); } }

        //public IEnumerable<ValueDescription> DJLXList
        //{ get { return EnumHelper.GetAllValuesAndDescriptions<DJLX>(); } }
        #endregion
    }
}
